package day0310;

import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
import java.lang.reflect.Array;
import java.util.Arrays;

public class FileDemo05 {

    public static void main(String[] args) {
        File file = new File("d:/temp");

//        String[] list = file.list(new FilenameFilter() {
//            @Override
//            public boolean accept(File dir, String name) {
//                return name.endsWith(".java");
//            }
//        });

//        FilenameFilter filenameFilter = (dir, name) -> name.endsWith(".java");
//        String[] list = file.list(filenameFilter);

        String[] list = file.list((dir, name) -> name.endsWith(".java"));

//        String[] list = file.list();
        System.out.println(Arrays.toString(list));

//        File[] files = file.listFiles(new FileFilter(){
//
//            @Override
//            public boolean accept(File pathname) {
//                return pathname.isFile();
//            }
//        });


//        FileFilter fileFilter = f -> f.isFile();
        File[] files = file.listFiles(f -> f.isFile());
        System.out.println(Arrays.toString(files));
    }
}


